package cn.nubia.admin.api.jinshan.controller;

import cn.nubia.admin.api.jinshan.service.CheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * 文件检查
 * Created by wangj on 2015/7/23.
 */
@Controller
public class CheckFileController {

    @Autowired
    CheckService checkService;

    @RequestMapping(value = "/checkFile/callback")
    @ResponseBody
    public Map<String,Integer>  callback(Integer tpl , String sign , String v , String scanResult) {
        Map<String,Integer> result = new HashMap<>();
        if (!checkService.checkParams(tpl ,sign ,v ,scanResult)){
            result.put("error" ,1);
            return result;
        }

        checkService.callback(scanResult);

        result.put("error" ,0);
        return result;
    }
}
